Sub Query:
   Writing one query inside another query makes sub query.
   It is also k.a., Nested Query.


Q: How it works?
Ans: In sub query, the inner query will execute first. Based on the output of the inner query the outer query will get execute.

Note: The sub query can be written for single table or multiple tables put together. If you want to write a sub query for multiple tables, both the tables should have common columns OR atleast common records between them.


Examples:
Q1: Find second max salary from emp?
Q2: Find third max salary from emp?
Q3: Find second min salary from emp?
Q4: Find third min salary from emp?
Q5: Identify the employee name who is getting max salary from emp table?
Q6: Identify the department names in which employees present?
Q7: Identify the department name in which emp are not present?
Q8: Identify the department name in which highest salaried emp present?
Q9: Among salesman who is getting max sal?
Q10: Find the location in which min salaried employee present?
Q11: Identify the department name & place for the employee who is president?
Q12: Identify the department & location for those employees who are getting the commission?


Not sub queries:
Q10: Find emp details who are getting commission?
Q11: Find emp details who are not getting commission?
Q12: Identify the person name who doesnot have manager?
